package com.ruoyi.cms.service.impl;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cms.mapper.CmsOrderMapper;
import com.ruoyi.cms.domain.CmsOrder;
import com.ruoyi.cms.service.ICmsOrderService;

/**
 * 订单列表Service业务层处理
 * 
 * @author fyliu
 * @date 2025-04-11
 */
@Service
public class CmsOrderServiceImpl implements ICmsOrderService 
{
    @Autowired
    private CmsOrderMapper cmsOrderMapper;

    /**
     * 查询订单列表
     * 
     * @param id 订单列表主键
     * @return 订单列表
     */
    @Override
    public CmsOrder selectCmsOrderById(Long id)
    {
        return cmsOrderMapper.selectCmsOrderById(id);
    }

    /**
     * 查询订单列表列表
     * 
     * @param cmsOrder 订单列表
     * @return 订单列表
     */
    @Override
    public List<CmsOrder> selectCmsOrderList(CmsOrder cmsOrder)
    {
        return cmsOrderMapper.selectCmsOrderList(cmsOrder);
    }

    /**
     * 新增订单列表
     * 
     * @param cmsOrder 订单列表
     * @return 结果
     */
    @Override
    public int insertCmsOrder(CmsOrder cmsOrder)
    {
        cmsOrder.setCreateTime(DateUtils.getNowDate());
        return cmsOrderMapper.insertCmsOrder(cmsOrder);
    }

    /**
     * 修改订单列表
     * 
     * @param cmsOrder 订单列表
     * @return 结果
     */
    @Override
    public int updateCmsOrder(CmsOrder cmsOrder)
    {
        return cmsOrderMapper.updateCmsOrder(cmsOrder);
    }

    /**
     * 批量删除订单列表
     * 
     * @param ids 需要删除的订单列表主键
     * @return 结果
     */
    @Override
    public int deleteCmsOrderByIds(Long[] ids)
    {
        return cmsOrderMapper.deleteCmsOrderByIds(ids);
    }

    /**
     * 删除订单列表信息
     * 
     * @param id 订单列表主键
     * @return 结果
     */
    @Override
    public int deleteCmsOrderById(Long id)
    {
        return cmsOrderMapper.deleteCmsOrderById(id);
    }

    @Override
    public List<CmsOrder> selectListByUserIdAndDate(int secondNum, int amount) {
        return cmsOrderMapper.selectListByUserIdAndDate(secondNum, amount);
    }
}
